<?php
/**
 * 认证用户后台提现模块
 *
 * @author    wangmx <wangmx@yunys.com.cn>
 * @copyright 2016 QuanZhouYunYiShang Inc.
 */
namespace App\Http\Controllers\Front;

use Response;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use DB;

class WithdrawDepositController extends Controller
{

    /**
     * 提现列表页面
     */
    public function withdrawDeposit(Request $request)
    {
        $user_id = $request->session()->get('user_id');
        $lists = DB::table('apply_withdraws')->where('user_id', $user_id)->orderBy('withdraw_number', 'desc')->distinct()->get();
        return view('Front/withdrawDeposit/withdrawDeposit')->with('lists', $lists);
    }

    /**
     * 提现操作页面
     */
    public function withdrawDepositOperation(Request $request)
    {
        $user_id = $request->session()->get('user_id');
        $bank_card_no = DB::table('user_bank_infos')->where(['user_id' => $user_id, 'result' => 2])->value('bank_card_no');
        $user_card_id = DB::table('user_bank_infos')->where(['user_id' => $user_id, 'result' => 2])->value('id');
        $userinfo = DB::table('users')->where('user_id', $user_id)->first();
        return view('Front/withdrawDeposit/operation')->with('userinfo', $userinfo)->with(['bank_card_no' => $bank_card_no, 'user_card_id' => $user_card_id]);
    }
}